package com.soft.admin.web;

import java.io.IOException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.soft.admin.dto.AssistDTO;
import com.soft.admin.service.AssistService;

@Controller
@RequestMapping(value = "/admin/assist.do")
public class AssistController extends BaseController {
	private AssistService assistService;
	
	@RequestMapping(params = "index")
	public String get(HttpServletResponse response, HttpServletRequest request) 
			throws IOException {
		String res = this.assistService.get();
		response.getWriter().print(res);
		return null;
	}
	
	@RequestMapping(params = "edit")
	public String edit(HttpServletResponse response, HttpServletRequest request, AssistDTO params) 
			throws IOException {
		String res = this.assistService.addOrEdit(request, params);
		response.getWriter().print(res);
		return null;
	}

	@Autowired
	public void setAssistService(AssistService assistService) {
		this.assistService = assistService;
	}
	
}
